﻿<!DOCTYPE html>
<html lang="en">
<head>
    <title id="Description">This demo shows how to display jqxLoader in jqxGrid.</title>
    <meta name="keywords" content="jQuery loader, jQWidgets, jqxLoader, loader" />
    <meta name="description" content="This demo shows how to display jqxLoader in jqxGrid." />
    <link rel="stylesheet" href="../../jqwidgets/styles/jqx.base.css" type="text/css" />
    <script type="text/javascript" src="../../scripts/jquery-1.11.1.min.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxcore.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxloader.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxdata.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxbuttons.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxscrollbar.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxmenu.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxcheckbox.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxlistbox.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxdropdownlist.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxgrid.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxgrid.sort.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxgrid.pager.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxgrid.selection.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxgrid.edit.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxgrid.columnsresize.js"></script>
    <script type="text/javascript" src="../../scripts/demos.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            $("#jqxLoader").jqxLoader({  width: 100, height: 60, imagePosition: 'top', autoOpen: true });
            // prepare the data
            var source =
            {
                datatype: "jsonp",
                datafields: [
                    { name: 'countryName', type: 'string' },
                    { name: 'name', type: 'string' },
                    { name: 'population', type: 'float' },
                    { name: 'continentCode', type: 'string' }
                ],
                url: "http://api.geonames.org/searchJSON"
            };

            var dataAdapter = new $.jqx.dataAdapter(source, {
                downloadComplete: function (data, status, xhr) { },
                loadComplete: function () { $('#jqxLoader').jqxLoader('close'); },
                loadError: function (xhr, status, error) { },
                formatData: function (data) {
                    $.extend(data, {
                        featureClass: "P",
                        style: "full",
                        maxRows: 50,
                        username: "jqwidgets"
                    });
                    return data;
                }
            });
            // initialize jqxGrid
            $("#jqxGrid").jqxGrid(
            {
                width: 850,
                height: 400,
                source: dataAdapter,
                columnsresize: true,
                showdefaultloadelement: false,
                autoshowloadelement: false,
                columns: [
                    { text: 'Country Name', datafield: 'countryName', width: 200 },
                    { text: 'City', datafield: 'name', width: 170 },
                    { text: 'Population', datafield: 'population', cellsformat: 'f', width: 170 },
                    { text: 'Continent Code', datafield: 'continentCode', minwidth: 110 }
                ]
            });
        });
    </script>
</head>
<body class='default'>
    <div id="jqxLoader">
    </div>
    <div id="jqxGrid">
    </div>
</body>
</html>
